package fr.demo.list;

import android.os.Parcel;
import android.os.Parcelable;


/**
 * Data model of a Contact
 * @author hong
 *
 */
public class Contact implements Parcelable {
	/**
	 * The name
	 */
	private String name;
	/**
	 * The first name
	 */
	private String firstName;
	
	/**
	 * FACTORY use by system for automically create a Contact object from a Parcel Object
	 */
	public static final Parcelable.Creator<Contact> CREATOR = new Parcelable.Creator<Contact>() {
		public Contact createFromParcel(Parcel in) {
			return new Contact(in);
		}
		public Contact[] newArray(int size) {
			return new Contact[size];
		}
	};
	
	/**
	 * Reader INFORMATION from parcel
	 * @param in The Parcel to deserialized
	 */
	public Contact(Parcel in) {
		// TODO Auto-generated constructor stub
		name = in.readString();
		firstName = in.readString();
	}
	
	/**
	 * Writter INFORMATION into the parcel
	 * @param dest The parcel which contains the data serialized
	 * @param flags Additional flags information (optionnal)
	 */
	public void writeToParcel(Parcel dest, int flags) {
		// TODO Auto-generated method stub
		dest.writeString(name);
		dest.writeString(firstName);
	}
	/**
	 * Used for describe the Data in the parcel
	 */
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}
	
	
	
	
	/**
	 * Constructor with initialization
	 * @param name
	 * @param firstName
	 */
	public Contact(String name, String firstName) {
		super();
		this.name = name;
		this.firstName = firstName;
	}

	/**
	 * 
	 * @return The name
	 */
	public String getName() {
		return name;
	}
	/**
	 * 
	 * @param name The name
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * 
	 * @return The first name
	 */
	public String getFirstName() {
		return firstName;
	}
	/**
	 * 
	 * @param fisrtName The first name
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

}
